package com.example.touch;

import android.view.View;
import android.widget.Button;

import com.example.touch.base.BaseActivity;
import com.example.touch.views.SignatureView;

public class SignatureActivity extends BaseActivity implements View.OnClickListener {
   private Button mClearButton;
   private Button mSaveButton;
   private SignatureView mSignView;
   @Override
   public int getLayoutId() {
      return R.layout.activity_signature;
   }

   @Override
   public void init() {
      mClearButton = findViewById(R.id.clear);
      mSaveButton = findViewById(R.id.save);
      mSignView = findViewById(R.id.sign_view);
      mClearButton.setOnClickListener(this);
      mSaveButton.setOnClickListener(this);
   }

   @Override
   public void onClick(View v) {
      if (isFastClick()) {
         //showToast("请勿连续快速点击");
         showToast(R.string.no_fast_click);
         return;
      }
      int id = v.getId();
      if (id == R.id.clear) {
         mSignView.clear();
      } else if (id == R.id.save) {
         mSignView.saveImageToGallery();
      }
   }
}
